
<div id="content" style="background-color:#ffffff">
  <div id="content-header">
    <div id="breadcrumb"> <a href="index.php?m=admin&t=main" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> 后台首页</a> <a href="#">应用管理</a> <a href="#" class="current"><{if !$gvar.fget.id}>新增渠道应用<{else}>编辑渠道应用<{/if}></a> </div>
  </div>
  <div class="container-fluid" style=' margin-top:20px'>
   
     <fieldset class="layui-elem-field">
      <legend>渠道应用信息</legend>
      <div class="layui-field-box">
    <form class="layui-form " action="?m=admin&o=ticket&t=channel_app_save&id=<{$gvar.fget.id}>" method="post">	
     <!--<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
      <legend>基本配置</legend>
     </fieldset>-->
      <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
          <input type="text" name="name" value="<{$data.name}>"  lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
        </div>
      </div>
      
       <div class="layui-form-item">
        <label class="layui-form-label">微信号</label>
        <div class="layui-input-block">
          <input type="text" name="weixin_name" value="<{$data.weixin_name}>"  lay-verify="required" autocomplete="off" placeholder="请输入微信号" class="layui-input">
        </div>
      </div>
	  <{if $gvar.fget.channel_id}>
	  <input type="hidden" name='channel_id' value="<{$gvar.fget.channel_id}>">
	  <{else}>
	  <div class="layui-form-item">
        <label class="layui-form-label">渠道</label>
        <div class="layui-input-block">
          <select name="channel_id" >
            
            <{section name=list loop=$group}> 
            <option value="<{$group[list].id}>" <{if $group[list].id==$data.channel_id}>selected="selected"<{/if}>><{$group[list].channel_name}></option>
             <{/section}>
          </select>
        </div>
      </div>
	  <{/if}>
	  <div class="layui-form-item">
        <label class="layui-form-label">KEY</label>
        <div class="layui-input-inline">
          <input type="text" id='app_key' name="app_key" value="<{$data.app_key}>" lay-verify="required" autocomplete="off" placeholder="请生成key" class="layui-input">
         </div>
		 <div class="layui-input-inline">
			<a id='create_key' class="layui-btn  layui-btn-warm  layui-btn-small">生成key</a>
         </div>
       </div>
      <!--<fieldset class="layui-elem-field layui-field-title" >
          <legend>版权信息</legend>
       </fieldset>-->
      <{$data.copyright}>
      <br><br>
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
          <!--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
        </div>
      </div>
    </form>
      </div>
</fieldset>
  </div>
</div>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form()
  ,layer = layui.layer
  //,layedit = layui.layedit
  //,laydate = layui.laydate;
  
  //创建一个编辑器
  //var editIndex = layedit.build('LAY_demo_editor');
 
  //自定义验证规则
 /* form.verify({
    title: function(value){
      if(value.length < 5){
        return '标题至少得5个字符啊';
      }
    }
    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
  
  
  
  //监听提交
  form.on('submit(demo1)', function(data){
    layer.alert(JSON.stringify(data.field), {
      title: '最终的提交信息'
    })
    return false;
  });*/
  
  
});
$(function(){
	

	$("#create_key").click(function(){
		
		$("#app_key").val(getUuid())
	})
	
	function getUuid(){
	  var len=32;//32长度
	  var radix=16;//16进制
	  var chars='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');var uuid=[],i;radix=radix||chars.length;if(len){for(i=0;i<len;i++)uuid[i]=chars[0|Math.random()*radix];}else{var r;uuid[8]=uuid[13]=uuid[18]=uuid[23]='-';uuid[14]='4';for(i=0;i<36;i++){if(!uuid[i]){r=0|Math.random()*16;uuid[i]=chars[(i==19)?(r&0x3)|0x8:r];}}}
	  return uuid.join('');
	}  

})
</script>